package insumos.dao;

import java.sql.*;

public class Aplicacion1 {

    public static void main(String[] args) {
        try {
            Class.forName("com.mysql.jdbc.Driver");
            Connection con =
                    DriverManager.getConnection("jdbc:mysql://127.0.0.1/masters3", "root", "");
            Statement stmt = con.createStatement();
            String idUsuario = "1";
            ResultSet rs = stmt.executeQuery("select idInsumos,tipo_tela,cantidad_tela,precio_tela,color_tela,color_hilo,cantidad_hilo,precio_hilo,tipo from insumos where idInsumos=' " + idUsuario + " ' ");
            if (rs.next()) {
                System.out.println("Tipo_tela: " + rs.getString("tipo_tela"));
                System.out.println("Cantidad_tela: " + rs.getString("cantidad_tela"));
                System.out.println("Precio_tela: " + rs.getString("precio_tela"));
                System.out.println("Color_tela: " + rs.getString("color_tela"));
                System.out.println("Color_hilo: " + rs.getString("color_hilo"));
                System.out.println("Cantidad_hilo: " + rs.getString("cantidad_hilo"));
                System.out.println("Precio_hilo: " + rs.getString("precio_hilo"));
                System.out.println("Tipo: " + rs.getString("tipo"));
            }
            rs.close();
            stmt.close();
            con.close();
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }
}

